﻿/*
-----------------------------------------------------------------------------
This source file is part of Cell Cloud.

Copyright (c) 2009-2012 Cell Cloud Team - cellcloudproject@gmail.com

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/

#ifndef CellConfig_h
#define CellConfig_h


/* There are three modes for handling asserts in Cell:
0 - STANDARD - Standard asserts in debug builds, nothing in release builds
1 - RELEASE_EXCEPTIONS - Standard asserts in debug builds, exceptions in release builds
2 - EXCEPTIONS - Exceptions in debug builds, exceptions in release builds
*/
/* 在 Cell 中使用的3种断言模式：
0 - STANDARD - 在 debug 版中是标准断言，在 release 版中不使用
1 - RELEASE_EXCEPTIONS - 在 debug 版中是标准断言，在 release 版中是异常
2 - EXCEPTIONS - 在 debug 版中是异常，在 release 版中也是异常
*/
#define CELL_ASSERT_MODE_STANDARD 0
#define CELL_ASSERT_MODE_RELEASE_EXCEPTIONS 1
#define CELL_ASSERT_MODE_EXCEPTIONS 2

#ifndef CELL_ASSERT_MODE
#	define CELL_ASSERT_MODE CELL_ASSERT_MODE_STANDARD
#endif

// define the memory allocator configuration to use
// 定义内存分配器配置
#define CELL_MEMORY_ALLOCATOR_STD 1
#define CELL_MEMORY_ALLOCATOR_NED 3
#define CELL_MEMORY_ALLOCATOR_NEDPOOLING 4

#ifndef CELL_MEMORY_ALLOCATOR
#	define CELL_MEMORY_ALLOCATOR CELL_MEMORY_ALLOCATOR_NED
#endif

// Whether to use the custom memory allocator in STL containers
// 是否在 STL 容器中使用自定义内存分配器
#ifndef CELL_CONTAINERS_USE_CUSTOM_MEMORY_ALLOCATOR
#	define CELL_CONTAINERS_USE_CUSTOM_MEMORY_ALLOCATOR 1
#endif


//if you want to make cell::String use the custom memory allocator then set:
//#define CELL_STRING_USE_CUSTOM_MEMORY_ALLOCATOR 1
// Doing this will mean Cell's strings will not be compatible with std::string however
// 如果你想让 cell::String 使用自定义的内存分配器则：
//#define CELL_STRING_USE_CUSTOM_MEMORY_ALLOCATOR 1
// 这样做将意味着 Cell 的 string 将不能和 std::string 兼容
#ifndef CELL_STRING_USE_CUSTOM_MEMORY_ALLOCATOR
#   define CELL_STRING_USE_CUSTOM_MEMORY_ALLOCATOR 0
#endif


// enable or disable the memory tracker, recording the memory allocations & tracking leaks
// default is to disable since it's expensive, but you can enable if needed per build target
// 启用或禁用内存追踪，记录内存分配情况并追踪内存泄漏
// 由于内存追踪开销较大，默认该选项被禁用
#ifndef CELL_MEMORY_TRACKER_DEBUG_MODE
#	define CELL_MEMORY_TRACKER_DEBUG_MODE 0
#endif

#ifndef CELL_MEMORY_TRACKER_RELEASE_MODE
#	define CELL_MEMORY_TRACKER_RELEASE_MODE 0
#endif


// 警告：不能修改该参数配置
#ifndef CELL_THREAD_SUPPORT
#	define CELL_THREAD_SUPPORT 1
#endif


/* Provider for threading functionality, there are 3 options.
1 - BOOST - Boost libraries provide threading functionality.
2 - POCO - Poco libraries provide threading functionality.
3 - TBB - TBB library provides threading functionality.
*/
/* 3种线程函数支持选择：
1 - 使用 Boost 库提供的线程函数
2 - 使用 Poco 库提供的线程函数
3 - 使用 TBB 库提供的线程函数
*/
#define CELL_THREAD_PROVIDER_BOOST 1
#define CELL_THREAD_PROVIDER_POCO 2
#define CELL_THREAD_PROVIDER_TBB 3

#ifndef CELL_THREAD_PROVIDER
#	define CELL_THREAD_PROVIDER CELL_THREAD_PROVIDER_BOOST
#endif

/** 是否使用 Crash Report
*/
#define CRASH_REPORT_SUPPORTED 1

#endif // CellConfig_h
